|
|
|
|
|
|
|
Notice that if you click the Seek button, you eventually get an error message. You cannot apply a Seek method to a non-table object. Also, you cannot apply a Find method to a table object. Later, you'll learn how to write a single locate routine that is smart enough to figure out which search method to use for your Recordset object. |
|
|
|
|
|
|
|
|
Creating Your Own Bound Controls |
|
|
|
|
|
|
|
|
Up to this point, you have been creating your Visual Basic database programs by using the data control as the heart of the system. After learning about the Microsoft JET data engine and covering some basics on searching techniques, you are now ready to create an OLE Server library that allows you to build solid data entry forms without using the data control. The rest of this day is devoted to constructing this OLE Server library. |
|
|
|
|
| |
|
|
|
|
A finished version of the RecObject OLE Server library is contained in the RECOBJECT.CLS class file on the CD that comes with this book. |
|
|
|
|
|
|
|
|
|
|
There is a series of operations that must be handled for any data entry system. First, let's outline these operations, and then you can use that outline as a guide in constructing your library functions. The following is a list of common operations used in almost all data entry forms: |
|
|
|
|
|
|
|
|
·RSOpen: This routine opens a database and selects a set of records for processing. |
|
|
|
|
|
|
|
|
·RSInit: This routine initializes the data entry form and prepares the on-form controls for reading and writing data records. |
|
|
|
|
|
|
|
|
·RSLocate: This routine provides a front end for performing Seek and Find operations on the dataset. |
|
|
|
|
|
|
|
|
·RSRead: This routine reads the selected record and loads the on-form controls with the contents of the data fields. |
|
|
|
|
|
|
|
|
·RSEnable: This routine handles the enabling and disabling of the input controls to manage user updates to the data form. |
|
|
|
|
|
|
|
|
·RSWrite: This routine copies the values from the data entry form back to the dataset for storage. |
|
|
|
|
|
|
|
|
·RSDelete: This routine gives the user the power to delete the current record from the dataset. |
|
|
|
|
|
|
|
|
In addition to the record-handling routines, you also build a set of routines to design and manage a command button toolbar. This toolbar provides access to basic data entry functions such as add, edit, delete, and locate, as well as the four browse actions: first, next, previous, |
|
|
|
|
|